package xrocketmq

import (
	"github.com/apache/rocketmq-client-go/v2"
	"github.com/apache/rocketmq-client-go/v2/consumer"
	"github.com/apache/rocketmq-client-go/v2/primitive"
)

func NewPullConsumer(groupName string, address []string) (rocketmq.PullConsumer, error) {
	res, err := rocketmq.NewPullConsumer(
		consumer.WithGroupName(groupName),
		consumer.WithNsResolver(primitive.NewPassthroughResolver(address)),
	)
	if err != nil {
		return nil, err
	}

	return res, nil
}
